using UnityEngine;
using QFramework;
using UnityEngine.Rendering.Universal;

namespace ProjectSurviver
{
	public partial class FxController : ViewController
	{
		private static FxController mDefault;

        void Awake()
        {
            mDefault = this;
        }

        void OnDestroy()
        {
            mDefault = null;
        }

		public static void Play(SpriteRenderer sprite, Color dissolveColor)
		{
			mDefault.EnemyDieFx.Instantiate()
			.Position(sprite.Position())
			.LocalScale(sprite.Scale())
			.Self(s =>
			{
				s.GetComponent<Dissolve>().DisolveColor = dissolveColor;
				s.sprite = sprite.sprite;
			})
			.Show();
		}
    }
}
